<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String path = request.getContextPath();
%>
<html>
<head>
    <title>我的日志</title>
    <link rel="stylesheet" href="<%=path%>/web/userinfo/css/log.css">
    <link rel="stylesheet" href="<%=path%>/web/userinfo/css/page.css">
</head>
<body>
<div class="make_head_title">我的日志
    <div style="float: right">
        <a target="_parent" href="${pageContext.request.contextPath}/web/blogger/fabu" class="btn btn-success" role="button">发布一篇新日志</a>
    </div>
</div>

<br>
<div class="manage-jobs">
<div class="single-manage-jobs table-responsive">

</div>
</div>

<script src="<%=path %>/web/static/js/modules/jquery-3.4.1.min.js"></script>
<script src="<%=path %>/web/static/layui/layui.all.js"></script>
</body>
</html>
<script>
    $(function () {
        initData(1);


        $(".single-manage-jobs").on("click", ".meneame a", function () { //给页码加点击事件
            var pageNum = $(this).data("id");
            initData(pageNum);
            return false;
        })


        $(".single-manage-jobs").on("click", "a.delete", function () { //删除日志
            var journalId = $(this).data("id");
            layer.confirm("确认删除日志吗，删除后不可恢复", { title: "删除确认",btn: ['确认', '取消'] }, function (index) {
                layer.close(index);
                $.get("${pageContext.request.contextPath}/web/userinfo/deleteByJournalId",{journalId:journalId},function () {
                    initData(1);
                    layer.msg('删除成功', {icon: 5});
                })
            });
        });


    })


    function initData(pageNum) {   //页码
        var pageNum = {pageNum: pageNum};
        $.get("${pageContext.request.contextPath}/web/userinfo/logList", pageNum, function (mes) {
                $(".single-manage-jobs").empty();
                $(".single-manage-jobs").html(mes);
            }
        );
    }


</script>
